-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add egress loss stat #195
Add egress loss stat #195
Conversation
5774919
to
0af7974
Compare
src/rtp/rtcp/twcc.rs
Outdated
@@ -1088,6 +1088,7 @@ impl TwccSendRegister { | |||
); | |||
} | |||
|
|||
println!("TWCC loss: {:?}", self.loss(Duration::from_secs(1), now)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Soz, left from debugging
|
||
Some((lost as f64) / (total as f64)) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks a bit expensive. Is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be, it's O(2n)
at worst with n == 1000
currently and runs every second. I don't really think the 2n
case will happen either
src/stats.rs
Outdated
@@ -68,6 +70,8 @@ pub struct PeerStats { | |||
pub timestamp: Instant, | |||
/// The last egress bandwidth estimate from the BWE subsystem, if enabled. | |||
pub bwe_tx: Option<Bitrate>, | |||
/// The egress loss over the last second expressed as a percentage value between 0.0 and 1.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fraction or ratio?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or just multiply by 100 and make it an u8?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think keeping it as f64 would be nice but I can reword it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f32?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No preference, I just defaulted to f64. Do we have a stated preference for the project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair, f32 should be sufficient. Will change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also if you say egress_loss_ratio it is clear that you return a ratio and I will expect numbers between 0 and 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also if you say egress_loss_ratio it is clear that you return a ratio and I will expect numbers between 0 and 1
Good point, although I know @algesten isn't a fan of long names :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed and type changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment still percentage
0af7974
to
457c485
Compare
now = now + Duration::from_millis(20); | ||
let loss = reg | ||
.loss(Duration::from_millis(150), now) | ||
.expect("Should be able to calcualte loss"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calculate
lgtm |
Calculate egress loss based on TWCC reports.
225b54c
to
e0058dc
Compare
Add an egress loss stat to
PeerStats
derived from TWCC reports.